<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <title>图书管理系统</title>
    <link rel="stylesheet" href="css/index.css?v=20170919">
    <script src="js/jquery-3.2.1.min.js"></script>
    <script src="js/layer/layer.js"></script>
    <script>

        function del(info,id){
            layer.confirm('是不是要删除:'+info+'？', {
                btn: ['确定','取消'] //按钮
            },function(){
                location.href = "/delbook/"+id;
            },null);
        }


        $(function(){
            $('.upbook').hide();
            //layer.msg('hello');
            $('a[id]').click(function(){
                del($(this).attr('title'),$(this).attr("id"));
            });

            $('.tt a[uid]').click(function(){


                layer.open({
                    type: 1,
                    title: '修改图书信息',
                    closeBtn: 0,
                    area: '516px',
                    skin: 'layui-layer-nobg', //没有背景色
                    shadeClose: true,
                    content: $('.upbook')
                });


            });

        })
    </script>
</head>
<body>
<h3>图书管理系统</h3>
<div class="upbook">
fffffffff
</div>
<table class="tt">
    <tr>
        <th>书籍名称</th>
        <th>价格</th>
        <th>出版日期</th>
        <th>操作</th>
    </tr>
    <c:forEach items="${books}" var="bk">
    <tr>
        <td>${bk.name}</td>
        <td>${bk.price}</td>
        <td><fmt:formatDate value="${bk.bdate}" pattern="yyyy年MM月dd日"/></td>
        <td>
            <a href="/delbook/${bk.id}" onclick="return confirm('是不是要删除：${bk.name}？')">删除</a>&nbsp;
            <a href="javascript:void(0)" onclick="del('${bk.name}',${bk.id})">删除</a>&nbsp;
            <a href="javascript:void(0)" id="${bk.id}" title="${bk.name}">删除</a>&nbsp;
            <a href="javascript:void(0)" uid="${bk.id}">修改</a>
        </td>
    </tr>
    </c:forEach>
    <tr>
        <td colspan="100">
            <a href="/addbook">添加新书</a>
        </td>
    </tr>
</table>
</body>
</html>
